function out   = doMacroSpanRegressions_finite(allYields,data,setupFilter,numPCAs)
T       = setupFilter.T;
numSim  = size(allYields,2);
numRep  = floor(numSim/T);
Rsqrt      = zeros(4,numRep);
for s=1:numRep
    labor  = data(1,(s-1)*T+1:s*T)';
    wage   = data(2,(s-1)*T+1:s*T)';
    dc     = data(3,(s-1)*T+1:s*T)';
    infl   = data(4,(s-1)*T+1:s*T)';

    % Using only the six bond yields in the estimation
    [pcaLoadings, pcaFactors,] = pca(data(5:10,(s-1)*T+1:s*T)','NumComponents',numPCAs);

    % Regression I
    % M_t = beta0 + beta1'*pca_t + u_t
    tmp     = nwest(labor,[ones(T,1),pcaFactors(:,1:numPCAs)],4);
    labor_regI = [tmp.rsqr]*100;

    tmp     = nwest(wage,[ones(T,1),pcaFactors(:,1:numPCAs)],4);
    wage_regI = [tmp.rsqr]*100;

    tmp    = nwest(dc,[ones(T,1),pcaFactors(:,1:numPCAs)],4);
    dc_regI    = [tmp.rsqr]*100;

    tmp        = nwest(infl,[ones(T,1),pcaFactors(:,1:numPCAs)],4);
    infl_regI  = tmp.rsqr*100;
    
    Rsqrt(:,s) = [labor_regI wage_regI dc_regI infl_regI];
end

%% Output
out.labor_regI   = mean(Rsqrt(1,:));
out.wage_regI    = mean(Rsqrt(2,:));
out.dc_regI      = mean(Rsqrt(3,:));
out.infl_regI    = mean(Rsqrt(4,:));
end